#include "plugin_test.h"

#include <iostream>

Engine::Engine()
{
	//std::cout << "Select a renderer:" << std::endl;
	//std::vector<String> sRendererList = m_RendererPluginMgr.getList();
	//std::vector<String>::iterator itPlugin;
	//int i = 0;
	//for (itPlugin = sRendererList.begin(); itPlugin != sRendererList.end(); ++itPlugin, ++i)
	//	std::cout << i << '\t' << *itPlugin << std::endl;
	//std::cout << "? ";
	//std::cin >> i;
	//m_pRenderer = m_RendererPluginMgr.loadPlugin(sRendererList[i]);
	//TODO: Think more about how plugins might be used.
	//         Interface-dependant.
	//         Could read single plugin name from xml file (or options menu), load plugin, and instantiate single instance on startup (e.g., renderer).
	//         Could search plugins directory for all plugins of correct interface, load and instantiate all, and register each against a certain image type.
	m_RendererPluginterface.loadPlugin("OpenGLRenderer");
	m_pRenderer = m_RendererPluginterface.createInstance("OpenGLRenderer");
	
	m_pRenderer->init();
	//TODO: Find out how the type of plugins is determined.
	
}

Engine::~Engine()
{
	
	delete m_pRenderer;
	m_pRenderer = 0;
	
	m_RendererPluginterface.unloadPlugin("libOpenGLRenderer");
	//TODO: Work out who should delete what.
	
}

int main()
{
	
	Engine e;
	
}
